<template>
  <div class="cus">
    <div class="cus_box" style="width:1000px;" v-loading="loading">
      <div class="title"><span>使用记录</span> <i @click="$emit('usage_record_call')"
          class="el-icon-close"></i></div>
      <div class="content">

        <el-form :inline="true" :model="dataForm" ref="dataForm" label-width="auto">
          <el-form-item label="" prop="adName">
            <el-input v-model="orderNo" type="text" placeholder="订单编号" style="width:150px;"
              clearable></el-input>
            <el-input v-model="sn" type="text" placeholder="设备编号" style="width:150px;" clearable>
            </el-input>
            </el-input>
          </el-form-item>
          <!--          <el-form-item label="" prop="adName">-->
          <!--            <el-date-picker-->
          <!--              v-model="value1"-->
          <!--              type="daterange"-->
          <!--              range-separator="至"-->
          <!--              start-placeholder="开始日期"-->
          <!--              end-placeholder="结束日期">-->
          <!--            </el-date-picker>-->
          <!--          </el-form-item>-->

          <el-form-item>
            <el-button @click="getData" type="primary">搜索</el-button>
          </el-form-item>

        </el-form>

        <el-table :data="tableData" height="250" highlight-current-row border style="width: 100%">
          <el-table-column prop="orderNo" label="订单编号" width="180">
          </el-table-column>
          <el-table-column prop="sn" label="设备编号" width="180">
          </el-table-column>
          <!--          <el-table-column-->
          <!--            prop="address"-->
          <!--            label="操作类型">-->
          <!--          </el-table-column>-->
          <el-table-column prop="actuallyPay" label="金额">
          </el-table-column>
          <el-table-column prop="stime" label="操作时间">
          </el-table-column>
        </el-table>

        <div class="btns">
          <el-button type="primary" @click="$emit('usage_record_call')">关闭</el-button>
          <!--          <el-button type="primary" @click="dataFormSubmit()">关联</el-button>-->
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { isMobile } from '@/utils/validate'
export default {
  data() {
    var validateMobile = (rule, value, callback) => {
      if (!isMobile(value)) {
        callback(new Error('手机号格式错误'))
      } else {
        callback()
      }
    };
    return {
      dataForm: {

      },
      loading: false,

      tableData: [],

      cardNo: '',
      sn: '',
      orderNo: ''

    }
  },
  computed: {

  },
  components: {

  },
  props: ['res'],

  mounted() {
    console.log(this.res);
    this.cardNo = this.res.cardNumber;
    this.getData();
  },
  methods: {
    async getData() {
      const res = await this.apis.ic_useList({
        pageNum: 1,
        pageSize: 100000,
        cardNo: this.cardNo,
        sn: this.sn,
        orderNo: this.orderNo
      });
      const list = res.rows || [];
      this.tableData = list;
    },
    // 表单提交
    dataFormSubmit() {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {

        }
      })
    },

  }
}
</script>
<style scoped lang='scss'>
</style>
